<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/c" prefix="c" %>
<%@taglib prefix="display" uri="http://displaytag.sf.net/el"%>
<%@ page import="java.text.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.lang.*"%>
<%@ page import="com.solution.webconstant.PermissionConstants" %>

<%
	HashMap permissionMap = ((HashMap)(session.getAttribute("userPermissionsInfo")));
%>
<script language="JavaScript">
function fnSearch()
{
	document.userForm.action='/searchUserResult.do?';
	document.userForm.submit();
}
function fnEditViewUserDetails(user_id_value, screen_type_value){
	document.userForm.screen_type.value=screen_type_value;
	document.userForm.user_id.value=user_id_value;
	document.userForm.action='/userSearchdetails.do?';
	document.userForm.submit();
}
function clearForm(formObj){
	var elements = formObj.elements;
	for(i=0; i<elements.length; i++){
		if(elements[i].type == "text")
			elements[i].value = "";
		if(elements[i].type == "select-one" || elements[i].type == "select-multiple")
			elements[i].selectedIndex = 0;
	}
}
</script>
<script language="JavaScript" src="js/Calendar.js" type="text/JavaScript"></script>
<html:form action="/searchUserResult">
	<html:hidden property="show_list" />
	<html:hidden property="screen_type" />
	<html:hidden property="user_id" />
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
  		<tr>
    		<td>
    			<table width="100%" border="0" cellspacing="0" cellpadding="0">
  					<tr>
  						<jsp:include page="userActionTab.jsp"/>	
  					</tr>
				</table>
			</td>
  		</tr>
  		<tr>
    		<td class="formbg" valign="top">
    			<table width="100%" border="0" cellspacing="0" cellpadding="0">
  					<tr>
    					<td>
    						<table width="100%" border="0" cellspacing="4" cellpadding="0">
	    						<tr>
									<td>&nbsp;</td>	
									<td>&nbsp;</td>
									<td>&nbsp;</td>
									<td>&nbsp;</td>
									<td>&nbsp;</td>
								</tr>
  								<tr>
    								<td colspan="6"><jsp:include page="showErrorMessage.jsp"/></td>
  								</tr>
								<tr>
									<td class="formText">First Name</td>
									<td><input name="first_name" id="first_name" class="form1" maxlength="20"/></td>
									<td class="formText">Last Name</td>
									<td><input name="last_name" id="last_name" class="form1" maxlength="20"/></td>
								</tr>
								<tr>
									<td class="formText">User Name</td>
									<td><input name="user_name" id="user_name" class="form1" maxlength="20"/></td>
									<td class="formText">User Type</td>
									<td>
										<html:select styleClass="form2" property="user_type" styleId="user_type">								
											<html:option value="1">Examiner</html:option>
											<html:option value="2">Examinee</html:option>
										</html:select>
									</td>
								</tr>
								<tr>
    								<td class="formText">Emp. Code/Role No.</td>
    								<td><input name="emp_code" id="emp_code" class="form1"/></td>
    								<td class="formText">Gender</td>
    								<td>
    									<html:select styleClass="form2" property="gender" styleId="gender" >
    										<html:option value="">--Select--</html:option>
											<html:option value="Male">Male</html:option>
											<html:option value="Female">Female</html:option>
										</html:select>
									</td>
  								</tr>
			  					<tr>
									<td height="25" colspan="4" valign="top"  >&nbsp;</td>
								</tr>
								<tr>
			       	 				<td height="25" colspan="4" align="center" valign="top">
			       	 					<input type="button" class="imageButton" value="Search" onClick="JavaScript:fnSearch()">
			       	 					<input type="button" class="imageButton" value="Reset" onClick="JavaScript:clearForm(this.form)">
			       	 				</td>
			      				</tr>
			      				<tr>
									<td height="25" colspan="4" align="center" valign="top" >&nbsp;</td>
								</tr>
							</table>
          				</td>
					</tr>
					<tr>
						<td>
							<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
								<logic:equal name="userForm" property="show_list" value="Y">
								<tr>
									<td>
										<display:table name="userForm.user_list" decorator="com.solution.decorator.UserDecorator"
											export="false"	requestURI="/searchUserResult.do" cellspacing="0" cellpadding="0"
											pagesize="10" class="results" id="user">
											<display:column property="firstName" title="First Name" />
											<display:column property="lastName" title="Last Name" />
											<display:column property="username" title="User Name" />
											<logic:present property="status" name="user">
											<bean:define id="displayStatus" property="status" name="user"/>
											<display:column title="Status"><bean:message key="<%="UserStatus."+displayStatus%>"/></display:column>
											</logic:present>								
											<logic:equal name="userForm" property="screen_type" value="Edit">
												<display:column property="actionEdit" title="Action" />
											</logic:equal>
											<logic:equal name="userForm" property="screen_type" value="View">
												<display:column property="actionView" title="Action" />
											</logic:equal>
											<display:setProperty name="basic.msg.empty_list">&nbsp;</display:setProperty> 
										</display:table>
									</td>
			            		</tr>
			            		</logic:equal>
			          		</table>
			          	</td>
					</tr>					
      			</table>
      		</td>
      	</tr>
		<tr>
					<td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td class="lowerCorner1"></td>
								<td class="lowerbg" width="800px" colspan="3" >&nbsp;</td>
								<td class="lowerCorner2"></td>
							  </tr>
							  </table>
					</td>
					</tr>
      </table> 		
</html:form>